﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BI.CF.Model;
using BI.CF.BLL;
using System.Data;

namespace BackStage
{
    public partial class BulletinShowAll : System.Web.UI.Page
    {
        BulletinBLL bll = new BulletinBLL();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                bullShow();
            }
        }
        public void bullShow()
        {
            string name = TextBox1.Text;
            AspNetPager1.PageSize = 5;
            AspNetPager1.RecordCount = bll.BulletinCount(name);
            Repeater1.DataSource = bll.BulletinShowAll(AspNetPager1.PageSize,AspNetPager1.CurrentPageIndex,name);
            Repeater1.DataBind();
        }
        protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int id =Convert.ToInt32(e.CommandArgument);
            string name = e.CommandName;
            if (name=="upd")
            {
                Response.Redirect("BullUpt.aspx?id=" + id);
            }
        }

        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            bullShow();
        }

        protected void Button3_Click(object sender, EventArgs e)
        {
            bullShow();
        }
    }
}